package com.chy.common;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.chy.entity.User;
import org.apache.commons.codec.binary.Base64;

import java.util.HashMap;
import java.util.Map;

public class Utils {
    public static <T> T MapGetValue(Map map,String key) {
        return (T) map.get(key);
    }

    /**
     * Object 转 HashMap<String,Object>
     * @param object 对象类需要有public无参构造，字段属性需要是public ，
     *               并且内部类也需要这样.
     * @return
     */
    public static HashMap<String,Object> ObjectToMap(Object object){
        return JSONObject.parseObject(JSONObject.toJSONString(object),HashMap.class);
    }



}
